home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-2.iso / os2 / gnucal.zip / configure.in < prev    next >
Text File  |  1995-12-09  |  23KB  |  808 lines

  1. dnl Process this file with autoconf to produce a configure script for gcal
  2.  
  3. dnl
  4. dnl Starting operations.
  5. dnl
  6. AC_INIT(gcal_def.h)dnl
  7. AC_CONFIG_HEADER(gcal_cfg.h)dnl
  8. AC_PREREQ(2.1)dnl
  9. AC_REVISION($Id: configure.in 2.4 1995/12/09 02:04:00 tom Exp $)dnl
  10.  
  11. dnl
  12. dnl Emit some text.
  13. dnl
  14. gcal_distname=gcal-`sed -e '/VERSION_NO/!d' -e 's/^.*"\(.*\)".*$/\1/' $srcdir/$ac_unique_file`
  15. echo
  16. echo "this is the automatic configuration step of $gcal_distname"
  17. echo
  18. echo "    --enable-feature=DIGIT+DIGIT+... where DIGIT is 1...6"
  19. echo
  20. echo "(1) --enable-cath    additional Catholic holidays."
  21. echo "(2) --enable-debug   includes some debugging code."
  22. echo "(3) --enable-easci   displaying using the extended ASCII character set."
  23. echo "(4) --enable-ger     defaults German texts, holidays and calendar style."
  24. echo "(5) --enable-ushdy   U.S. specific holidays."
  25. echo "(6) --enable-exit127 on --help, --version and --license, terminate"
  26. echo "                     with exit status 127, otherwise with 0."
  27. echo
  28. echo "    --enable-greg-ref=YEAR  year of Gregorian reform, either 1582 or 1752."
  29. echo
  30. echo "    --disable-hls    never use highlighting sequences."
  31. echo "    --disable-pager  never use external or simple, internal pager feature."
  32. echo "    --disable-rc     never use fixed date warnings feature."
  33. echo "    --disable-term   never use libtermcap or libtermlib."
  34. echo
  35. echo "please wait..."
  36. echo
  37.  
  38. dnl
  39. dnl Checks for package options.
  40. AC_MSG_CHECKING(for package options)
  41. dnl
  42. gcal_lang=English
  43. dnl
  44. gcal_arglist=
  45. gcal_enabled=
  46. gcal_implicit=
  47. gcal_illegal_defined=
  48. gcal_multiple_defined=
  49. dnl
  50. gcal_enable_cath=no
  51. gcal_enable_debug=no
  52. gcal_enable_easci=no
  53. gcal_enable_ger=no
  54. gcal_enable_ushdy=no
  55. gcal_enable_exit127=no
  56. dnl
  57. gcal_enable_hls=yes
  58. gcal_enable_pager=yes
  59. gcal_enable_rc=yes
  60. gcal_enable_term=yes
  61. dnl
  62. AC_ARG_ENABLE(feature,
  63.   [      --enable-feature=DIGIT+DIGIT+... where DIGIT is 1...6],
  64.   [gcal_feature=feature
  65.    IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}+"
  66.    for gcal_arg in $enableval; do
  67.      case $gcal_arg in
  68.        1) gcal_feature=cath
  69.           gcal_arglist="$gcal_arglist $gcal_feature"
  70.           if test "$gcal_enable_cath" != yes; then
  71.             AC_DEFINE(USE_CATH)
  72.             gcal_enable_cath=yes
  73.             gcal_enabled="$gcal_enabled $gcal_feature"
  74.           else
  75.             gcal_multiple_defined="$gcal_feature"
  76.           fi;;
  77.        2) gcal_feature=debug
  78.           gcal_arglist="$gcal_arglist $gcal_feature"
  79.           if test "$gcal_enable_debug" != yes; then
  80.             AC_DEFINE(DEBUG)
  81.             gcal_enable_debug=yes
  82.             gcal_enabled="$gcal_enabled $gcal_feature"
  83.           else
  84.             gcal_multiple_defined="$gcal_feature"
  85.           fi;;
  86.        3) gcal_feature=easci
  87.           gcal_arglist="$gcal_arglist $gcal_feature"
  88.           if test "$gcal_enable_easci" != yes; then
  89.             AC_DEFINE(USE_EASC)
  90.             gcal_enable_easci=yes
  91.             gcal_enabled="$gcal_enabled $gcal_feature"
  92.           else
  93.             gcal_multiple_defined="$gcal_feature"
  94.           fi;;
  95.        4) gcal_feature=ger
  96.           gcal_arglist="$gcal_arglist $gcal_feature"
  97.           if test "$gcal_enable_ger" != yes; then
  98.             if test "$enable_ushdy" != yes; then
  99.               AC_DEFINE(USE_GER)
  100.               gcal_lang=German
  101.               gcal_enable_ger=yes
  102.               gcal_enabled="$gcal_enabled $gcal_feature"
  103.             fi
  104.           else
  105.             gcal_multiple_defined="$gcal_feature"
  106.           fi;;
  107.        5) gcal_feature=ushdy
  108.           gcal_arglist="$gcal_arglist $gcal_feature"
  109.           if test "$gcal_enable_ushdy" != yes; then
  110.             if test "$gcal_lang" != German; then
  111.               AC_DEFINE(USE_USHDY)
  112.               gcal_lang=American
  113.               gcal_enable_ushdy=yes
  114.               gcal_enabled="$gcal_enabled $gcal_feature"
  115.             fi
  116.           else
  117.             gcal_multiple_defined="$gcal_feature"
  118.           fi;;
  119.        6) gcal_feature=exit127
  120.           gcal_arglist="$gcal_arglist $gcal_feature"
  121.           if test "$gcal_enable_exit127" != yes; then
  122.             AC_DEFINE(EXIT_STAT_HLP, 127)
  123.             gcal_enable_exit127=yes
  124.             gcal_enabled="$gcal_enabled $gcal_feature"
  125.           else
  126.             gcal_multiple_defined="$gcal_feature"
  127.           fi;;
  128.        *) if test "$gcal_arg" = no; then
  129.             gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  130.           else
  131.             AC_MSG_RESULT(hmm... whats this??)
  132.             AC_MSG_RESULT()
  133.             if test "$gcal_arg" = yes; then
  134.               AC_MSG_ERROR(not --enable-feature=DIGIT+DIGIT... given - aborting...)
  135.             else
  136.               AC_MSG_ERROR(invalid --enable-feature=$gcal_arg given - aborting...)
  137.             fi
  138.           fi;;
  139.      esac
  140.    done
  141.    IFS="$ac_save_ifs"])
  142. dnl
  143. AC_ARG_ENABLE(cath,
  144.   [  (1) --enable-cath       additional Catholic holidays.],
  145.   [gcal_feature=cath
  146.    if test "$enableval" = yes; then
  147.      gcal_arglist="$gcal_arglist $gcal_feature"
  148.      if test "$gcal_enable_cath" = yes; then
  149.        gcal_multiple_defined="$gcal_feature"
  150.      else
  151.        AC_DEFINE(USE_CATH)
  152.        gcal_enabled="$gcal_enabled $gcal_feature"
  153.      fi
  154.    else
  155.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  156.    fi])
  157. dnl
  158. AC_ARG_ENABLE(debug,
  159.   [  (2) --enable-debug      includes some debugging code.],
  160.   [gcal_feature=debug
  161.    if test "$enableval" = yes; then
  162.      gcal_arglist="$gcal_arglist $gcal_feature"
  163.      if test "$gcal_enable_debug" = yes; then
  164.        gcal_multiple_defined="$gcal_feature"
  165.      else
  166.        AC_DEFINE(DEBUG)
  167.        gcal_enabled="$gcal_enabled $gcal_feature"
  168.      fi
  169.    else
  170.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  171.    fi])
  172. dnl
  173. AC_ARG_ENABLE(easci,
  174.   [  (3) --enable-easci      displaying using the extended ASCII character set.],
  175.   [gcal_feature=easci
  176.    if test "$enableval" = yes; then
  177.      gcal_arglist="$gcal_arglist $gcal_feature"
  178.      if test "$gcal_enable_easci" = yes; then
  179.        gcal_multiple_defined="$gcal_feature"
  180.      else
  181.        AC_DEFINE(USE_EASC)
  182.        gcal_enabled="$gcal_enabled $gcal_feature"
  183.      fi
  184.    else
  185.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  186.    fi])
  187. dnl
  188. AC_ARG_ENABLE(ger,
  189.   [  (4) --enable-ger        defaults German texts, holidays and calendar style.],
  190.   [gcal_feature=ger
  191.    if test "$enableval" = yes; then
  192.      gcal_arglist="$gcal_arglist $gcal_feature"
  193.      if test "$gcal_enable_ger" = yes; then
  194.        gcal_multiple_defined="$gcal_feature"
  195.      else
  196.        AC_DEFINE(USE_GER)
  197.        gcal_lang=German
  198.        gcal_enabled="$gcal_enabled $gcal_feature"
  199.      fi
  200.    else
  201.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  202.    fi])
  203. dnl
  204. AC_ARG_ENABLE(ushdy,
  205.   [  (5) --enable-ushdy      U.S. specific holidays.],
  206.   [gcal_feature=ushdy
  207.    if test "$enableval" = yes; then
  208.      gcal_arglist="$gcal_arglist $gcal_feature"
  209.      if test "$gcal_enable_ushdy" = yes; then
  210.        gcal_multiple_defined="$gcal_feature"
  211.      else
  212.        AC_DEFINE(USE_USHDY)
  213.        if test "$gcal_lang" != German; then
  214.          gcal_lang=American
  215.        fi
  216.        gcal_enabled="$gcal_enabled $gcal_feature"
  217.      fi
  218.    else
  219.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  220.    fi])
  221. dnl
  222. AC_ARG_ENABLE(exit127,
  223.   [  (6) --enable-exit127    on --help etc. terminate with exit status 127.],
  224.   [gcal_feature=exit127
  225.    if test "$enableval" = yes; then
  226.      gcal_arglist="$gcal_arglist $gcal_feature"
  227.      if test "$gcal_enable_exit127" = yes; then
  228.        gcal_multiple_defined="$gcal_feature"
  229.      else
  230.        AC_DEFINE(EXIT_STAT_HLP, 127)
  231.        gcal_enabled="$gcal_enabled $gcal_feature"
  232.      fi
  233.    else
  234.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  235.    fi])
  236. dnl
  237. AC_ARG_ENABLE(greg-ref,
  238.   [      --enable-greg-ref=YEAR      year of Gregorian reform, either 1582 or 1752.],
  239.   [gcal_feature=greg-ref
  240.    gcal_invalid_year=no
  241.    gcal_got_year=yes
  242.    if test "$enableval" != no; then
  243.      changequote(<<, >>)dnl
  244.      gcal_gr=`echo $enableval | sed -e 's/[^0-9]//g' -e 's/^0+/*/g'`
  245.      changequote([, ])dnl
  246.      if test "$gcal_gr" = "$enableval"; then
  247.        if test -n "$gcal_gr"; then
  248.          if test "$gcal_gr" -gt "0"; then
  249.            if test "$gcal_gr" -eq "1582" || test "$gcal_gr" -eq "1752"; then
  250.              AC_DEFINE_UNQUOTED(GREG_${gcal_gr})
  251.              gcal_enabled="$gcal_enabled $gcal_feature=$gcal_gr"
  252.              gcal_arglist="$gcal_arglist $gcal_feature=$gcal_gr"
  253.            else
  254.              gcal_invalid_year=yes
  255.            fi
  256.          else
  257.            gcal_invalid_year=yes
  258.          fi
  259.        else
  260.          gcal_invalid_year=yes
  261.        fi
  262.      else
  263.        if test "$enableval" != yes; then
  264.          gcal_invalid_year=yes
  265.        else
  266.          gcal_got_year=no
  267.        fi
  268.      fi
  269.    else
  270.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  271.    fi
  272.    if test "$gcal_invalid_year" = yes || test "$gcal_got_year" = no; then
  273.      AC_MSG_RESULT(hmm... whats this??)
  274.      AC_MSG_RESULT()
  275.      if test "$gcal_got_year" = no; then
  276.        AC_MSG_ERROR(not $gcal_feature=YEAR given - aborting...)
  277.      else
  278.        AC_MSG_ERROR(invalid YEAR $enableval to $gcal_feature given - aborting...)
  279.      fi
  280.    fi])
  281. dnl
  282. AC_ARG_ENABLE(hls,
  283.   [      --disable-hls       never use highlighting sequences.],
  284.   [gcal_feature=hls
  285.    gcal_enable_hls=$enableval
  286.    if test "$gcal_enable_hls" = no; then
  287.      gcal_enabled="$gcal_enabled NO-$gcal_feature"
  288.    else
  289.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  290.    fi])
  291. dnl
  292. AC_ARG_ENABLE(pager,
  293.   [      --disable-pager     never use external or simple, internal pager feature.],
  294.   [gcal_feature=pager
  295.    gcal_enable_pager=$enableval
  296.    if test "$gcal_enable_pager" = no; then
  297.      gcal_enabled="$gcal_enabled NO-$gcal_feature"
  298.    else
  299.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  300.    fi])
  301. dnl
  302. AC_ARG_ENABLE(rc,
  303.   [      --disable-rc        never use fixed date warnings feature.],
  304.   [gcal_feature=rc
  305.    gcal_enable_rc=$enableval
  306.    if test "$gcal_enable_rc" = no; then
  307.      gcal_enabled="$gcal_enabled NO-$gcal_feature"
  308.    else
  309.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  310.    fi])
  311. dnl
  312. AC_ARG_ENABLE(term,
  313.   [      --disable-term      never use libtermcap or libtermlib.],
  314.   [gcal_feature=term
  315.    gcal_enable_term=$enableval
  316.    if test "$gcal_enable_term" = no; then
  317.      gcal_enabled="$gcal_enabled NO-$gcal_feature"
  318.    else
  319.      gcal_illegal_defined="$gcal_illegal_defined $gcal_feature"
  320.    fi])
  321. dnl
  322. gcal_feature=hls
  323. if test "$gcal_enable_hls" = yes; then
  324.   gcal_implicit="$gcal_implicit $gcal_feature"
  325.   AC_DEFINE(USE_HLS) 
  326. fi
  327. dnl
  328. gcal_feature=pager
  329. if test "$gcal_enable_pager" = yes; then
  330.   gcal_implicit="$gcal_implicit $gcal_feature"
  331.   AC_DEFINE(USE_PAGER) 
  332. fi
  333. dnl
  334. gcal_feature=rc
  335. if test "$gcal_enable_rc" = yes; then
  336.   gcal_implicit="$gcal_implicit $gcal_feature"
  337.   AC_DEFINE(USE_RC) 
  338. fi
  339. dnl
  340. gcal_feature=term
  341. if test "$gcal_enable_term" = yes; then
  342.   gcal_implicit="$gcal_implicit $gcal_feature"
  343. fi
  344. dnl
  345. if test -n "$gcal_illegal_defined" || test -n "$gcal_multiple_defined"; then
  346.   AC_MSG_RESULT(hmm... whats this??)
  347.   AC_MSG_RESULT()
  348.   if test -n "$gcal_illegal_defined"; then
  349.     AC_MSG_WARN(you have enabled/disabled features illegaly - see:)
  350.     AC_MSG_WARN()
  351.     AC_MSG_WARN($gcal_illegal_defined)
  352.   else
  353.     AC_MSG_WARN(you have enabled features twice or more - see:)
  354.     AC_MSG_WARN()
  355.     AC_MSG_WARN($gcal_arglist)
  356.   fi
  357.   AC_MSG_WARN()
  358.   AC_MSG_WARN(lets stop now so you can specify them correctly...)
  359.   exit 1
  360. fi
  361. dnl
  362. if test -n "$gcal_enabled"; then
  363.   AC_MSG_RESULT(found: $gcal_enabled $gcal_implicit)
  364. else
  365.   AC_MSG_RESULT(explicitly found: none)
  366.   AC_CHECK_PROG(LINE, line, line)
  367.   AC_MSG_WARN(NO --enable / --disable arguments given explicitly!)
  368.   AC_MSG_WARN(if this is OK then press RET to continue...)
  369.   AC_MSG_WARN(otherwise break with C-c and rerun with arguments...)
  370.   if test -n "$ac_cv_prog_LINE"; then
  371.     line >/dev/null
  372.   else
  373.     read gcal_kbd_input >/dev/null
  374.   fi
  375.   AC_MSG_RESULT(ok --- configuring with: $gcal_implicit)
  376. fi
  377.  
  378. echo
  379. echo "configuring for *** $gcal_lang *** users   =8^)"
  380. echo
  381. lang=$gcal_lang
  382. AC_SUBST(lang)dnl
  383.  
  384. dnl
  385. dnl Checks for programs.
  386. AC_CHECKING(for programs)
  387. dnl
  388. dnl Checks for makeinfo.
  389. dnl
  390. AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo)
  391. if test -z "$ac_cv_prog_MAKEINFO"; then
  392.   AC_MSG_RESULT()
  393.   AC_MSG_WARN(no automatic recreation of text documentation/info files!)
  394.   AC_MSG_WARN(Makefile targets *txt* and *info* will never be executed.)
  395.   AC_MSG_RESULT()
  396. else
  397.   AC_MSG_CHECKING(for makeinfo version)
  398.   changequote(<<, >>)dnl
  399.   AC_CACHE_VAL(gcal_cv_prog_MAKEINFO_VERSION,
  400.     gcal_cv_prog_MAKEINFO_VERSION=`makeinfo --version 2>&1 | sed -e 's/[^0-9]//g'`)
  401.   changequote([, ])dnl
  402.   gcal_makeinfo_error=no
  403.   if test -n "$gcal_cv_prog_MAKEINFO_VERSION"; then
  404.     AC_MSG_RESULT($gcal_cv_prog_MAKEINFO_VERSION)
  405.     if test "$gcal_cv_prog_MAKEINFO_VERSION" -lt "120"; then
  406.       gcal_makeinfo_error=yes
  407.     fi
  408.   else
  409.     gcal_makeinfo_error=yes
  410.     AC_MSG_RESULT(unknown)
  411.   fi
  412.   if test "$gcal_makeinfo_error" = yes; then
  413.     gcal_cv_prog_MAKEINFO_VERSION=
  414.     AC_MSG_RESULT()
  415.     AC_MSG_WARN(no automatic recreation of text documentation files!)
  416.     AC_MSG_WARN(the makeinfo program is out of date.)
  417.     AC_MSG_WARN(Makefile target *txt* will never be executed.)
  418.     AC_MSG_RESULT()
  419.   fi
  420.   MAKEINFOVERSION=$gcal_cv_prog_MAKEINFO_VERSION
  421.   AC_SUBST(MAKEINFOVERSION)dnl
  422. fi
  423. dnl
  424. dnl Checks for texi2dvi.
  425. dnl
  426. AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi)
  427. if test -z "$ac_cv_prog_TEXI2DVI"; then
  428.   AC_MSG_RESULT()
  429.   AC_MSG_WARN(no automatic creation of dvi files!)
  430.   AC_MSG_WARN(Makefile target *dvi* will never be executed.)
  431.   AC_MSG_RESULT()
  432. fi
  433. dnl
  434. dnl Checks for shar.
  435. dnl
  436. AC_CHECK_PROGS(SHAR, gshar shar)
  437. if test -z "$ac_cv_prog_SHAR"; then
  438.   AC_MSG_RESULT()
  439.   AC_MSG_WARN(no automatic creation of shared distribution!)
  440.   AC_MSG_WARN(Makefile target *distshar* will never be executed.)
  441.   AC_MSG_RESULT()
  442. fi
  443. dnl
  444. dnl Checks for zip.
  445. dnl
  446. AC_CHECK_PROG(ZIP, zip, zip)
  447. if test -z "$ac_cv_prog_ZIP"; then
  448.   AC_MSG_RESULT()
  449.   AC_MSG_WARN(no automatic creation of zipped distribution!)
  450.   AC_MSG_WARN(Makefile target *distzip* will never be executed.)
  451.   AC_MSG_RESULT()
  452. fi
  453. dnl
  454. dnl Checks for zoo.
  455. dnl
  456. AC_CHECK_PROG(ZOO, zoo, zoo)
  457. if test -z "$ac_cv_prog_ZOO"; then
  458.   AC_MSG_RESULT()
  459.   AC_MSG_WARN(no automatic creation of zooed distribution!)
  460.   AC_MSG_WARN(Makefile target *distzoo* will never be executed.)
  461.   AC_MSG_RESULT()
  462. else
  463.   AC_CHECK_PROG(FIND, find, find)
  464.   if test -z "$ac_cv_prog_FIND"; then
  465.     AC_MSG_RESULT()
  466.     AC_MSG_WARN(no automatic creation of zooed distribution!)
  467.     AC_MSG_WARN(Makefile target *distzoo* will never be executed.)
  468.     AC_MSG_RESULT()
  469.   fi
  470. fi
  471. dnl
  472. dnl Checks for lha.
  473. dnl
  474. AC_CHECK_PROGS(LHA, lha lharc)
  475. if test -z "$ac_cv_prog_LHA"; then
  476.   AC_MSG_RESULT()
  477.   AC_MSG_WARN(no automatic creation of lhaed distribution!)
  478.   AC_MSG_WARN(Makefile target *distlha* will never be executed.)
  479.   AC_MSG_RESULT()
  480. fi
  481. dnl
  482. dnl Checks for archivers (gtar, tar) and compressors (gzip, compress).
  483. dnl
  484. AC_CHECK_PROGS(TAR, gtar tar)
  485. if test -z "$ac_cv_prog_TAR"; then
  486.   AC_MSG_RESULT()
  487.   AC_MSG_WARN(no automatic creation of gzipped/compressed distribution!)
  488.   AC_MSG_WARN(Makefile target *dist* will never be executed.)
  489.   AC_MSG_RESULT()
  490. else
  491.   AC_CHECK_PROG(GZIP, gzip, gzip)
  492.   if test -z "$ac_cv_prog_GZIP"; then
  493.     AC_CHECK_PROG(COMPRESS, compress, compress)
  494.   fi
  495.   if test -z "$ac_cv_prog_GZIP" && test -z "$ac_cv_prog_COMPRESS"; then
  496.     AC_MSG_RESULT()
  497.     AC_MSG_WARN(no automatic creation of gzipped/compressed distribution!)
  498.     AC_MSG_WARN(Makefile target *dist* will never be executed.)
  499.     AC_MSG_RESULT()
  500.   fi
  501. fi
  502. dnl
  503. dnl Checks for text converters/interpeters (perl, awk).
  504. dnl
  505. AC_CHECK_PROG(PERL, perl, perl)
  506. if test -z "$ac_cv_prog_PERL"; then
  507.   AC_PROG_AWK
  508.   if test -z "$ac_cv_prog_AWK"; then
  509.     AC_MSG_RESULT()
  510.     AC_MSG_WARN(no automatic installation of dates files!)
  511.     AC_MSG_WARN(Makefile target *installdates* will never be executed.)
  512.     AC_MSG_RESULT()
  513.   fi
  514. fi
  515. dnl
  516. dnl Checks for pager programs (less, more).
  517. dnl
  518. AC_CHECK_PROG(PAGER1, less, less)
  519. AC_CHECK_PROG(PAGER2, more, more)
  520. AC_DEFINE_UNQUOTED(PAGER_PROG, "$PAGER1")
  521. AC_DEFINE_UNQUOTED(PAGER2_PROG, "$PAGER2")
  522. dnl
  523. dnl Checks for install program/script.
  524. dnl
  525. AC_PROG_INSTALL
  526.  
  527. dnl
  528. dnl Checks for C compiler.
  529. AC_MSG_RESULT()
  530. AC_CHECKING(for C compiler)
  531. dnl
  532. AC_PROG_CC
  533. if test -z "$ac_cv_prog_CC"; then
  534.   AC_MSG_RESULT(hmm... whats this??)
  535.   AC_MSG_RESULT()
  536.   AC_MSG_ERROR(no C compiler found - aborting...)
  537. fi
  538. dnl
  539. AC_PROG_GCC_TRADITIONAL
  540.  
  541. dnl
  542. dnl Checks for operating system variants.
  543. AC_MSG_RESULT()
  544. AC_CHECKING(for operating system variants)
  545. dnl
  546. AC_AIX
  547. AC_MINIX
  548. AC_ISC_POSIX
  549.  
  550. dnl
  551. dnl Checks for libraries.
  552. AC_MSG_RESULT()
  553. AC_CHECKING(for libraries)
  554. dnl
  555. if test "$gcal_enable_term" = yes; then
  556.   gcal_termcap_ok=no
  557.   gcal_termlib_ok=no
  558.   TERMLIBS=
  559.   AC_CHECK_LIB(termcap,
  560.     tgetent,
  561.     [AC_DEFINE(HAVE_LIBTERMCAP)
  562.      TERMLIBS="-ltermcap"])
  563.   AC_CHECK_LIB(termlib,
  564.     tgetent,
  565.     [have_termlib=yes],
  566.     [have_termlib=no])
  567.   dnl
  568.   dnl Solaris has termcap, but it don't work without libucb
  569.   dnl which is broken, so we use termlib.
  570.   dnl
  571.   AC_MSG_CHECKING(for working terminal libraries)
  572.   SAVE_LIBS=$LIBS
  573.   LIBS="$LIBS $TERMLIBS"
  574.   AC_TRY_LINK(,
  575.     [tgetent(0); tgetflag(0); tgetnum(0); tgetstr(0);],
  576.     [gcal_termcap_ok=yes])
  577.   if test "$gcal_termcap_ok" = yes; then
  578.     AC_MSG_RESULT(using $TERMLIBS)
  579.   else
  580.     TERMLIBS="-ltermlib"
  581.     LIBS="$SAVE_LIBS"
  582.     LIBS="$LIBS $TERMLIBS"
  583.     if test "$have_termlib" = yes; then
  584.       AC_TRY_LINK(,
  585.         [tgetent(0); tgetflag(0); tgetnum(0); tgetstr(0);],
  586.         [gcal_termlib_ok=yes])
  587.       if test "$gcal_termlib_ok" = yes; then
  588.         AC_DEFINE(HAVE_LIBTERMLIB)
  589.         AC_MSG_RESULT(using $TERMLIBS)
  590.       fi
  591.     fi
  592.   fi
  593.   if test "$gcal_termcap_ok" = no && test "$gcal_termlib_ok" = no; then
  594.     LIBS="$SAVE_LIBS"
  595.     AC_MSG_RESULT(hmm... whats this??)
  596.     AC_MSG_RESULT()
  597.     AC_MSG_WARN(no terminal libraries available)
  598.     AC_MSG_WARN()
  599.     AC_MSG_WARN(this means $gcal_distname will use its defaults now)
  600.     AC_MSG_WARN(and is unable to support several terminal types!)
  601.     AC_MSG_WARN(note: $gcal_distname would work more flexible if)
  602.     AC_MSG_WARN(libtermcap.a and/or libtermlib.a are installed.)
  603.     AC_MSG_RESULT()
  604.   fi
  605. fi #Using termlibs
  606.  
  607. dnl
  608. dnl Checks for header files.
  609. AC_MSG_RESULT()
  610. AC_CHECKING(for header files)
  611. dnl
  612. AC_STDC_HEADERS
  613. AC_CHECK_HEADERS(stdio.h stdlib.h string.h unistd.h ctype.h assert.h signal.h fcntl.h)
  614. AC_CHECK_HEADERS(termio.h termios.h sgtty.h)
  615. if test "$gcal_enable_term" = yes; then
  616.   if test "$gcal_termcap_ok" = yes || test "$gcal_termlib_ok" = yes; then
  617.     AC_CHECK_HEADERS(termcap.h)
  618.   fi
  619. fi #Using termlibs
  620. AC_CHECK_HEADERS(sys/ioctl.h sys/stream.h sys/ptem.h sys/types.h sys/time.h)
  621. AC_HEADER_SYS_WAIT
  622.  
  623. dnl
  624. dnl Checks for typedefs.
  625. AC_MSG_RESULT()
  626. AC_CHECKING(for typedefs)
  627. dnl
  628. AC_TYPE_PID_T
  629. AC_MSG_CHECKING(for time_t)
  630. AC_CACHE_VAL(gcal_cv_type_time_t,
  631.   AC_TRY_COMPILE([
  632.     #if TIME_WITH_SYS_TIME
  633.     #  include <sys/time.h>
  634.     #  include <time.h>
  635.     #else
  636.     #  if HAVE_SYS_TIME_H
  637.     #    include <sys/time.h>
  638.     #  else
  639.     #    include <time.h>
  640.     #  endif
  641.     #endif],
  642.     [time_t t = 0;],
  643.     [gcal_cv_type_time_t=yes],
  644.     [gcal_cv_type_time_t=no]))
  645. if test "$gcal_cv_type_time_t" = yes; then
  646.   AC_DEFINE(HAVE_TIME_T)
  647. fi
  648. AC_MSG_RESULT($gcal_cv_type_time_t)
  649.  
  650. dnl
  651. dnl Checks for structures.
  652. AC_MSG_RESULT()
  653. AC_CHECKING(for structures)
  654. dnl
  655. AC_HEADER_TIME
  656.  
  657. dnl
  658. dnl Checks for compiler characteristics.
  659. AC_MSG_RESULT()
  660. AC_CHECKING(for compiler characteristics)
  661. dnl
  662. AC_C_CONST
  663. dnl
  664. AC_MSG_CHECKING(for void)
  665. AC_CACHE_VAL(gcal_cv_c_void,
  666.   AC_TRY_COMPILE(,
  667.     [void *foo = 0;],
  668.     [gcal_cv_c_void=yes],
  669.     [gcal_cv_c_void=no]))
  670. if test "$gcal_cv_c_void" = yes; then
  671.   AC_DEFINE(HAVE_VOID)
  672. fi
  673. AC_MSG_RESULT($gcal_cv_c_void)
  674.  
  675. dnl
  676. dnl Checks for library functions.
  677. AC_MSG_RESULT()
  678. AC_CHECKING(for library functions)
  679. dnl
  680. AC_CHECK_FUNCS(dup dup2 strtol strstr strchr strrchr)
  681. dnl
  682. dnl Some systems have termios.h but not the corresponding functions.
  683. dnl
  684. AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
  685. dnl
  686. dnl Checks for ctype functions.
  687. AC_MSG_RESULT()
  688. AC_CHECKING(for ctype library functions)
  689. dnl
  690. AC_MSG_CHECKING(for isdigit)
  691. AC_CACHE_VAL(gcal_cv_func_isdigit,
  692.   AC_TRY_LINK([
  693.     #if HAVE_CTYPE_H
  694.     #  include <ctype.h>
  695.     #endif],
  696.     [static int x; x = isdigit(x);],
  697.     [gcal_cv_func_isdigit=yes],
  698.     [gcal_cv_func_isdigit=no]))
  699. if test "$gcal_cv_func_isdigit" = yes; then
  700.   AC_DEFINE(HAVE_ISDIGIT)
  701. fi
  702. AC_MSG_RESULT($gcal_cv_func_isdigit)
  703. dnl
  704. AC_MSG_CHECKING(for isalnum)
  705. AC_CACHE_VAL(gcal_cv_func_isalnum,
  706.   AC_TRY_LINK([
  707.     #if HAVE_CTYPE_H
  708.     #  include <ctype.h>
  709.     #endif],
  710.     [static int x; x = isalnum(x);],
  711.     [gcal_cv_func_isalnum=yes],
  712.     [gcal_cv_func_isalnum=no]))
  713. if test "$gcal_cv_func_isalnum" = yes; then
  714.   AC_DEFINE(HAVE_ISALNUM)
  715. fi
  716. AC_MSG_RESULT($gcal_cv_func_isalnum)
  717. dnl
  718. AC_MSG_CHECKING(for upper/lower)
  719. AC_CACHE_VAL(gcal_cv_func_upper_lower,
  720.   AC_TRY_LINK([
  721.     #if HAVE_CTYPE_H
  722.     #  include <ctype.h>
  723.     #endif],
  724.     [static int x; x = tolower(x); x = toupper(x); x = islower(x); x = isupper(x);],
  725.     [gcal_cv_func_upper_lower=yes],
  726.     [gcal_cv_func_upper_lower=no]))
  727. if test "$gcal_cv_func_upper_lower" = yes; then
  728.   AC_DEFINE(HAVE_UPPER_LOWER)
  729. fi
  730. AC_MSG_RESULT($gcal_cv_func_upper_lower)
  731.  
  732. dnl
  733. dnl Checks for external variable ospeed in the termcap/termlib library.
  734. AC_MSG_RESULT()
  735. AC_CHECKING(for external variables)
  736. dnl
  737. if test "$gcal_enable_term" = yes; then
  738.   if test "$gcal_termcap_ok" = yes || test "$gcal_termlib_ok" = yes; then
  739.     if test "$gcal_termcap_ok" = yes; then
  740.       AC_MSG_CHECKING(termcap for ospeed)
  741.     else
  742.       AC_MSG_CHECKING(termlib for ospeed)
  743.     fi
  744.     AC_CACHE_VAL(gcal_cv_var_ospeed_test_1,
  745.       AC_TRY_LINK([
  746.         #if HAVE_SYS_TYPES_H
  747.         #  include <sys/types.h>
  748.         #endif
  749.         #if HAVE_TERMIOS_H
  750.         #  include <termios.h>
  751.         #endif
  752.         #if HAVE_TERMCAP_H
  753.         #  include <termcap.h>
  754.         #endif],
  755.         [ospeed = 0;],
  756.         [gcal_cv_var_ospeed_test_1=yes],
  757.         [gcal_cv_var_ospeed_test_1=no]))
  758.     if test "$gcal_cv_var_ospeed_test_1" = no; then
  759.       AC_CACHE_VAL(gcal_cv_var_ospeed_test_2,
  760.         AC_TRY_LINK(,
  761.           [extern short ospeed; ospeed = 0;],
  762.           [gcal_cv_var_ospeed_test_2=yes],
  763.           [gcal_cv_var_ospeed_test_2=no]))
  764.     fi
  765.     if test "$gcal_cv_var_ospeed_test_1" = yes || test "$gcal_cv_var_ospeed_test_2" = yes; then
  766.       AC_DEFINE(HAVE_OSPEED)
  767.       if test "$gcal_cv_var_ospeed_test_2" = yes; then
  768.         AC_DEFINE(MUST_DCL_OSPEED)
  769.       fi
  770.       AC_MSG_RESULT(yes)
  771.     else
  772.       AC_MSG_RESULT(no)
  773.     fi
  774.   fi
  775. fi #Using termlibs
  776.  
  777. dnl
  778. dnl Checks for system services.
  779. AC_MSG_RESULT()
  780. AC_CHECKING(for system services)
  781. dnl
  782. AC_SYS_INTERPRETER
  783. if test "$ac_cv_sys_interpreter" = yes; then
  784.   AC_DEFINE(HAVE_SYS_INTERPRETER)
  785. fi
  786.  
  787. dnl
  788. dnl Ending operations.
  789. dnl
  790. AC_MSG_RESULT()
  791. AC_SUBST(CFLAGS)dnl
  792. AC_OUTPUT(Makefile)dnl
  793.  
  794. dnl
  795. dnl After all, create the timestamp file
  796. dnl
  797. echo timestamp > stamp-h
  798.  
  799. dnl
  800. dnl Emit some text.
  801. dnl
  802. echo
  803. echo "Bored? Fallen asleep??   All checks done!"
  804. echo
  805. echo "Perhaps you might want to inspect the created"
  806. echo "Makefile now for tuning some settings..."
  807. echo
  808.